﻿using CardMaker.Library.Services;
using Moq;

namespace CardMaker.UnitTest.Helpers;

public class CardTemplateStorageHelper
{
    public static void RemoveDatabaseFile() =>
        File.Delete(CardTemplateStorage.CardTemplateDbPath);

    public static async Task<CardTemplateStorage> GetInitializedCardTemplateStorage()
    {
        var preferenceStorageMock = new Mock<IPreferenceStorage>();
        preferenceStorageMock.Setup(p =>
            p.Get(CardTemplateStorageConstant.VersionKey, -1)).Returns(-1);
        var mockPreferenceStorage = preferenceStorageMock.Object;
        var cardTemplateStorage = new CardTemplateStorage(mockPreferenceStorage);
        await cardTemplateStorage.InitializeAsync();
        return cardTemplateStorage;
    }
}